var xmlHttp;
var exploerType;
var toolArray = new Array();


function createXMLHttpRequest() {

    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        exploerType = "IE";
    }else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
        exploerType = "firefox";
    }	
}
function toolBarStartRequest(xmlFileName) {
	
    createXMLHttpRequest();

    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", xmlFileName, false);
    xmlHttp.send(null);
}



function handleStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            var doc = xmlHttp.responseXML;
			var toolBar = new Array();
			if(exploerType == "IE"){
				try{
					var root = doc.childNodes; //根节点
					
					var toolBarNum = root[1].childNodes.length; //一级节点数<tool>
	
					for(i = 0; i < toolBarNum; i++){
						toolBar[i] = new Array();
						var toolBarPropertiesNum = root[1].childNodes[i].childNodes.length; //子节点数
						for(j = 0; j < toolBarPropertiesNum; j++){
							toolBar[i][j] = root[1].childNodes[i].childNodes[j].childNodes[0].nodeValue;//子节点值
						}
					}
				}catch (e){}
			}else{
				try{
					var root = doc.childNodes[0]; //根节点<tool>
					var toolBarNum = root.childNodes.length; //一级节点数<tool>
					var n = 0;
					
					for(i = 1; i < toolBarNum; i+=2){
						toolBar[n] = new Array();
						var toolBarPropertiesNum = root.childNodes[i].childNodes.length;//子节点数
						var m = 0;
						for(j = 1; j < toolBarPropertiesNum; j+=2){
							toolBar[n][m] = root.childNodes[i].childNodes[j].textContent;//子节点值
							m++;	
						}
						n++;
					}
				}catch(e){}
			}
			this.toolArray = toolBar;
        }

    }

} 

function returnArg(){
	return this.toolArray;
}